<?php
	function autoLoader($className){
	    //Directories added here must be
		//relative to the script going to use this file.
		//New entries can be added to this list
	    $directories = array(
	      'php/class/',
	      '../class/',
	      '../../class/'
	    );
	    
	    //Add your file naming formats here
	    $fileNameFormats = array(
	      '%s.class.php'
	    );
	
	    // this is to take care of the PEAR style of naming classes
	    $path = str_ireplace('_', '/', $className);
	    if(@include_once $path.'.php'){
	        return;
	    }
	    foreach($directories as $directory){
	        foreach($fileNameFormats as $fileNameFormat){
	            $path = $directory.sprintf($fileNameFormat, $className);
	            if(file_exists($path)){
	                include_once $path;
	                return;
	            }
	        }
	    }
	}
	
	function formatPrice($price)
	{
		if(strpos($price, ".")) {
			while(strlen(substr($price,strpos($price,".")+1)) < 2) {
				$price = $price.'0';
			}
		} else {
			$price = $price.'.00';
		}
		
		if(strlen(substr($price,0,strpos($price,"."))) == 0) {
			$price = '0'.$price;
		}

		return $price;
	}
	spl_autoload_register('autoLoader');
	
	$user = new User();
	$profile = new Profile();
	$login = new Login();
	$city = new City();
	
	if(isset($_SESSION['user'])) {
		$user = unserialize($_SESSION['user']);
	}
	
?>